<template>
<div>
		<mt-header fixed title="标题部分"></mt-header>
		<div id="back" v-show="isshow" >
			<a href="javascript:void(0)" @click="backto">< 返回</a>
		</div>
		<router-view></router-view>
		<nav class="mui-bar mui-bar-tab">
			<router-link class="mui-tab-item" to="/home">
				<span class="mui-icon mui-icon-home"></span>
				<span class="mui-tab-label">首页</span>
			</router-link>
			<router-link class="mui-tab-item" to="/tabbar-with-chat">
				<span class="mui-icon mui-icon-email"></span>
				<span class="mui-tab-label">会员</span>
			</router-link>
			<router-link class="mui-tab-item" to="/shopcar/car">
				<span class="mui-icon mui-icon-contact">
					<span class="mui-badge">0</span></span>
				<span class="mui-tab-label">购物车</span>
			</router-link>
			<router-link class="mui-tab-item" to="/tabbar-with-map">
				<span class="mui-icon mui-icon-gear"></span>
				<span class="mui-tab-label">设置</span>
			</router-link>
		</nav>
	</div>
</template>
<script>
// import { Toast } from 'mint-ui';
import {vm,COUNT} from './vm.js'
vm.$on(COUNT,count=>{
	// console.log(input);
	var num = document.querySelector('.mui-badge');
	num.innerHTML = parseInt(num.innerHTML)+count;
})
	export default{
		data(){
			return{
				isshow:false
			}
		},
		watch:{
			'$route':function(newroute,oldroute){
				if(newroute.path.toLowerCase()=='/home'){
					this.isshow =false;
				} else{
					this.isshow =true;
				}
			}
		},
		methods:{
			backto(){
				this.$router.go(-1);
			}
		}
	}
</script>
<style scoped>
#back{
	width: 60px;
	position: absolute;
	top: 8px;
	left: 10px;
	z-index: 101;
}
#back a{
	color: white;
	font-size: 14px;
}
</style>